package huawei.exam1;

import java.util.Scanner;

/**
 * @author : Rookie
 * @description :
 * @date : 2023/6/22
 */
public class HJ17 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        String[] opers = str.split(";");
        Point point = new Point(0, 0);
        for (String oper: opers) {
            if (oper == null || oper.equals("")) {
                continue;
            }
            if (oper.startsWith("A") || oper.startsWith("S") || oper.startsWith("W") || oper.startsWith("D")) {
                String subStr = oper.substring(1);
                if (isNumber(subStr)) {
                    int num = Integer.parseInt(subStr);
                    if (oper.startsWith("A")) {
                        point.executeA(num);
                    }
                    if (oper.startsWith("S")) {
                        point.executeS(num);
                    }
                    if (oper.startsWith("W")) {
                        point.executeW(num);
                    }
                    if (oper.startsWith("D")) {
                        point.executeD(num);
                    }
                }

            }
        }
        System.out.println(point.x + "," + point.y);
    }

    public static boolean isNumber(String subStr) {
        for (int i = 0; i < subStr.length(); i++) {
            char c = subStr.charAt(i);
            if (!Character.isDigit(c)) {
                return false;
            }
        }
        return true;
    }

    static class Point {

        int x;
        int y;

        public Point(int x,int y) {
            this.x = x;
            this.y = y;
        }

        public void executeA(int num) {
            this.x = this.x - num;
        }

        public void executeS(int num) {
            this.y = this.y - num;
        }

        public void executeW(int num) {
            this.y = this.y + num;
        }

        public void executeD(int num) {
            this.x = this.x + num;
        }

    }
}
